package com.lsu.command.experiment;

import javax.swing.*;

/**
 * @Author wang suo
 * @Date 2020/10/21 0021 8:01
 * @Version 1.0
 */
public class Test extends JFrame {

    private Test() {
        Receiver receiver = new Receiver();
        ConcreteSubject concreteSubject = new ConcreteSubject();
        Command command = new ConcreteCommand(receiver, concreteSubject);
        Invoker invoker = new Invoker(command, concreteSubject);
        ConcreteObserverMouseLoc mouseLoc = new ConcreteObserverMouseLoc();
        ConcreteObserverCircleLoc circleLoc = new ConcreteObserverCircleLoc();
        concreteSubject.addObserver(mouseLoc);
        concreteSubject.addObserver(circleLoc);
        this.add("North", circleLoc);
        this.add("South", mouseLoc);
        this.add("Center", invoker);
        this.setSize(800, 600);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new Test();
    }
}
